package com.shxy.service.impl;

import com.shxy.dao.common.*;
import com.shxy.entity.common.*;
import com.shxy.entity.common.enums.*;
import com.shxy.service.ICommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 通用信息管理类
 */
@Service
public class CommonService implements ICommonService {
    @Autowired private DepartmentDao departmentDao;

    @Override
    public List<String> getGenderList() {
        return Arrays.stream(GenderEnum.values()).map(genderEnum -> genderEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getLevelList() {
        return Arrays.stream(LevelEnum.values()).map(LevelEnum::getName).collect(Collectors.toList());
    }

    @Override
    public List<String> getAchieveTypeList() {
        return Arrays.stream(AchieveType.values()).map(achieveType -> achieveType.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getDegreeList() {
        return Arrays.stream(DegreeEnum.values()).map(degreeEnum -> degreeEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<DepartmentBean> getDepartmentList() {
        return departmentDao.findAllByLevel(0);
    }

    @Override
    public List<String> getDistrictList() {
        return Arrays.stream(DistrictEnum.values()).map(districtEnum -> districtEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getEducationList() {
        return Arrays.stream(EducationEnum.values()).map(educationEnum -> educationEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getEthicList() {
        return Arrays.stream(EthicEnum.values()).map(ethicEnum -> ethicEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getIdentityList() {
        return Arrays.stream(IdentityEnum.values()).map(identityEnum -> identityEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getPoliticalList() {
        return Arrays.stream(PoliticalEnum.values()).map(politicalEnum -> politicalEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getPositionList() {
        return Arrays.stream(PositionEnum.values()).map(positionEnum -> positionEnum.getName()).collect(Collectors.toList());
    }

    @Override
    public List<String> getSubjectList() {
        return Arrays.stream(SubjectEnum.values()).map(subjectEnum -> subjectEnum.getName()).collect(Collectors.toList());
    }
}
